diff options
| author | Adam Soltys <[email protected]> | 2023-10-07 23:30:52 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-10-07 23:30:52 -0700 |
| commit | 222bbc9080fbb15861cc5c0802449fcf06a53532 (patch) | |
| tree | 95f9ef93daacf8f9b5bf7e5f3a181b46747f08df /src/routes/(app)/[username]/invoice/[hash]/+layout.server.js | |
| parent | 6b7f03fcf87d346f8e25a954220570da5b9a5c3d (diff) | |
| download | coinos-ui-222bbc9080fbb15861cc5c0802449fcf06a53532.tar.gz coinos-ui-222bbc9080fbb15861cc5c0802449fcf06a53532.zip | |
fix more options invoices
Diffstat (limited to 'src/routes/(app)/[username]/invoice/[hash]/+layout.server.js')
| -rw-r--r-- | src/routes/(app)/[username]/invoice/[hash]/+layout.server.js | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/src/routes/(app)/[username]/invoice/[hash]/+layout.server.js b/src/routes/(app)/[username]/invoice/[hash]/+layout.server.js deleted file mode 100644 index eef24555..00000000 --- a/src/routes/(app)/[username]/invoice/[hash]/+layout.server.js +++ /dev/null @@ -1,25 +0,0 @@ -import Qr from 'qrcode-base64'; -import { get } from '$lib/utils'; -import { redirect } from '@sveltejs/kit'; - -export async function load({ depends, params, url, parent }) { - depends('app:invoice'); - - let { user } = await parent(); - let { hash } = params; - let invoice = await get(`/invoice/${hash}`); - - if (user && invoice.uid !== user.id && !url.pathname.includes('tip') && !url.searchParams.get('options')) - throw redirect(307, `/send/invoice/${hash}`); - - let { amount, pending, received } = invoice; - amount = parseInt(amount); - - let paid = (!amount && received) || (amount > 0 && (pending >= amount || received >= amount)); - if (paid && !url.pathname.endsWith('paid')) - throw redirect(307, `/${params.username}/invoice/${hash}/paid`); - - let sm = Qr.drawImg(invoice.text || '', { size: 300 }); - - return { hash, invoice, sm, lg: sm }; -} |
